<template>
  <div class="newcomer-zone">
    <!-- 服务标签选择 -->
    <div class="service-tabs">
      <div class="tab-item active">
        <span class="tab-text">会员精选</span>
        <span class="tab-subtitle">专业服务</span>
      </div>
      <div class="tab-item">
        <span class="tab-text">居家保洁</span>
        <span class="tab-subtitle">解放双手</span>
      </div>
      <div class="tab-item">
        <span class="tab-text">深层清洗</span>
        <span class="tab-subtitle">高温清洗</span>
      </div>
      <div class="tab-item">
        <span class="tab-text">新居开荒</span>
        <span class="tab-subtitle">一站搬家</span>
      </div>
    </div>
    
    <!-- 新人专区标题 -->
    <div class="zone-header">
      <h3 class="zone-title">新人专区</h3>
    </div>
    
    <!-- 新人见面礼卡片 -->
    <div class="zone-content" @click="handleZoneClick">
      <div class="zone-image">
        <img :src="newcomerZone.img" alt="新人专区" />
      </div>
      <div class="zone-info">
        <h4 class="gift-title">新人见面礼</h4>
        <p class="gift-subtitle">领130元最低优惠券</p>
      </div>
      <div class="zone-decoration">
        <div class="decoration-circle"></div>
        <div class="decoration-star">✨</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ElMessage } from 'element-plus'

const props = defineProps({
  newcomerZone: {
    type: Object,
    default: () => ({})
  }
})

const handleZoneClick = () => {
  ElMessage.success('欢迎来到新人专区！')
}
</script>

<style scoped>
.newcomer-zone {
  margin: 0 16px 20px;
}

.service-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background-color: #fff;
  border-radius: 12px;
  padding: 16px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 16px;
}

.zone-header {
  margin-bottom: 12px;
}

.zone-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.zone-content {
  background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  position: relative;
  overflow: hidden;
}

.zone-content:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.zone-image {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  overflow: hidden;
  margin-right: 16px;
  flex-shrink: 0;
}

.zone-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.zone-info {
  flex: 1;
  color: white;
}

.gift-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.gift-subtitle {
  font-size: 14px;
  margin: 0;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.zone-decoration {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.decoration-circle {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  position: absolute;
  top: -20px;
  right: -20px;
}

.decoration-star {
  font-size: 20px;
  position: relative;
  z-index: 2;
  animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(1.2) rotate(180deg); opacity: 0.8; }
}

.service-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background-color: #fff;
  border-radius: 12px;
  padding: 16px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 16px;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

.tab-item:hover {
  background-color: #f8f9fa;
}

.tab-item.active {
  background-color: #e6f4ff;
}

.tab-text {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  margin-bottom: 2px;
}

.tab-item.active .tab-text {
  color: #409eff;
}

.tab-subtitle {
  font-size: 11px;
  color: #666;
}

.tab-item.active .tab-subtitle {
  color: #409eff;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .newcomer-zone {
    margin: 0 12px 16px;
  }
  
  .zone-content {
    padding: 12px;
    margin-bottom: 12px;
  }
  
  .zone-image {
    width: 50px;
    height: 50px;
    margin-right: 12px;
  }
  
  .zone-title {
    font-size: 16px;
  }
  
  .zone-subtitle {
    font-size: 12px;
  }
  
  .service-tabs {
    padding: 12px 8px;
    gap: 6px;
  }
  
  .tab-item {
    padding: 6px 2px;
  }
  
  .tab-text {
    font-size: 11px;
  }
  
  .tab-subtitle {
    font-size: 10px;
  }
  
  .decoration-star {
    font-size: 16px;
  }
  
  .decoration-circle {
    width: 30px;
    height: 30px;
    top: -15px;
    right: -15px;
  }
}
</style>
